<?
	$entries = $args['perPage'];
	$total = $args['total'];
	$start = $args['start'];
	
	if ($start > $total) {
		$start = $total - $entries;
	}
	if ($start < 2) {
		$start = 1;
	}
	
	$totalTo = $start + $entries - 1;
	if ($totalTo > $total) {
		$totalTo = $total;
	}
	
	if ($args['url']) { 
		$url = $args['url'];
		$qs = '?';
		foreach($_GET as $key => $value) {
			if ($key != 's') { 
				$qs .= $key . '=' . $value . '&amp;';
			}				
		}
		$qs .= 's=' . ($start - $entries);
		$backURL = $url . $qs;
		$qs = '?';
		foreach($_GET as $key => $value) {
			if ($key != 's') { 
				$qs .= $key . '=' . $value . '&amp;';
			}
		}
		$qs .= 's=' . ($entries + 1);
		$nextURL = $url . $qs;
	}
	
	
	$s_backURL = '';
	$e_backURL = '';
	if ($start > 1) {
		$s_backURL = '<a href="' . $backURL . '">';
		$e_backURL = '</a>';
	}
	$s_forwardURL = '';
	$e_forwardURL = '';
	
	if ($total > ($entries + ($start - 1))) {
		$s_forwardURL = '<a href="' . $nextURL . '">';
		$e_forwardURL = '</a>';
	}
	
?>


